<?php
	require'../config.php';
	$userName = $_POST['userName'];
	$userPwd = $_POST['userPwd'];
	$vCode = strtolower($_POST['vCode']);
	$sCode = strtolower($_SESSION['verify']);
	if($vCode == $sCode){
	    $adminModel = new AdminModel();
	    $arr = $adminModel->admin_select("admin_pwd,admin_id","where admin_name='$userName'");
	    if(count($arr) == 1){
	    	if($arr[0]['admin_pwd'] == base64_encode($userPwd)){
	    	    $_SESSION['admin']=$userName;
	    	    $_SESSION['id'] = $arr[0]['admin_id'];
	    	    echo 1;
	    	}else{
	    	    echo "<font color='red'>密码错误</font>";
	    	}
	    }else{
	        echo "<font color='red'>用户不存在</font>";
	    }
	}else{
		echo "<font color='red'>验证码错误</font>";
	}
 
	
?>
